package com.xxb.service.user.rest;

import com.alibaba.fastjson.JSON;
import com.xxb.common.result.R;
import com.xxb.service.user.model.dto.LoginReqDTO;
import com.xxb.service.user.model.dto.LoginRespDTO;
import com.xxb.service.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author RenGaoshuai
 * @date 2023/7/20 17:55
 * @description
 */
@RestController
@RequestMapping("/user/login")
@Slf4j
public class UserLoginController {


    @Autowired
    private UserService userService;

    /**
     * 获取微信openid
     * @param reqDTO
     * @return
     */
    @PostMapping("/login")
    public R<LoginRespDTO> userLogin(@RequestBody LoginReqDTO reqDTO) {
        log.info("【updateUserTel】接口，请求参数：【{}】", JSON.toJSONString(reqDTO));
        LoginRespDTO login = userService.login(reqDTO);
        return R.ofSuccess(login);
    }
}
